import sys
import os

sys.path.append((os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))))
from app.app import create_app
from tests.utils import write_token,get_token

app = create_app()

def test_login():
    with app.test_client() as c:
        rv = c.post('/cms/user/login',json={
            "nickname":"pedro","password":"123456"
        })
        json_data = rv.get_json()
        print(json_data)
        assert json_data['access_token'] is not None
        assert rv.status_code == 200
